import matplotlib.image as mpimg
from matplotlib import pyplot as plt

# 读取原始PNG图片
png_fig_array = mpimg.imread("./../experiment_fig/interpolation.png")
# 子图片位置计数器
index = 1
# 所有支持插值方式列表
interpolation_algorithms = ['none', 'antialiased', 'nearest', 'bilinear']
for interpolation_algorithm in interpolation_algorithms:
    plt.subplot(2, 2, index)
    plt.title(interpolation_algorithm)
    plt.axis("off")
    plt.imshow(png_fig_array, interpolation=interpolation_algorithm)
    index += 1
#  注意先保存再显示，否则只是空白画布
plt.savefig(fname="./../experiment_fig/interpolation_algorithms.jpg")
plt.show()
